﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ConfigCheck_Edit.aspx.vb"
    Inherits="Map.ConfigCheck__Edit" %>

<%@ Register TagPrefix="mnu" Namespace="Mysoft.Map.Application.Menus" Assembly="Mysoft.Map.Application.Components" %>
<%@ Register TagPrefix="cnt" Namespace="Mysoft.Map.Application.Controls" Assembly="Mysoft.Map.Application.Components" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="/_common/styles/global.css" />
    <link rel="stylesheet" type="text/css" href="/_common/styles/select.css" />
    <link rel="stylesheet" type="text/css" href="/_nav/menu.css" />
    <link rel="stylesheet" type="text/css" href="/_nav/tabs.css" />
    <link rel="stylesheet" type="text/css" href="/_nav/nav.css" />
    <link rel="stylesheet" type="text/css" href="/_grid/map_grid.css" />
    <link rel="stylesheet" type="text/css" href="/_forms/styles/Form.css" />

    <script src="/_common/scripts/global.js" type="text/javascript"></script>

    <script src="/_common/scripts/Details.js" type="text/javascript"></script>

    <script src="/_controls/settings.aspx" type="text/javascript"></script>

    <script src="/_controls/util/util.js" type="text/javascript"></script>

    <script src="/_controls/datetime/date.js" type="text/javascript"></script>

    <script src="/_controls/datetime/time.js" type="text/javascript"></script>

    <script src="/_controls/number/number.js" type="text/javascript"></script>

    <script src="/_controls/lookup/map_lookup.js" type="text/javascript"></script>

    <script src="/_controls/find/find.js" type="text/javascript"></script>

    <script src="/_nav/menu.js" type="text/javascript"></script>

    <script src="/_forms/FormBase.js" type="text/javascript"></script>

    <script src="../Js/LMSCommon.js" type="text/javascript"></script>

    <script type="text/javascript">

        //页面初始化
        function window_onload()
        {
            HideMenu();
//            appForm._bAlert = false;
        }
        
                //配置检查
        function check()
        {
            openWaiting();
            window.setTimeout(InnerCheck, 0);
        }

        //配置检查
        function InnerCheck()
        {
            var messageDiv = document.getElementById("Message");
            messageDiv.innerHTML = "";
            
            var oHTTP = new ActiveXObject("Msxml2.XMLHTTP");
            var sUrl = "/ApplicationMap.aspx?functionid=00000305&actionid=01";
            oHTTP.open("POST", sUrl, false);
            oHTTP.send("<dataxml mysessionstate=\"" + document.all["___MYSESSIONSTATE"].value + "\"><userdataxml></userdataxml></dataxml>");

            // 要求返回xml格式<xml result="true/flase" errormessage="错误信息！">任意正确格式的xml</xml>。
            var xmlReturn = oHTTP.responseText;
            delete (oHTTP);

            var xmlDom = XMLDOM();

            try
            {
                xmlDom.loadXML(xmlReturn);

                var node = xmlDom.documentElement.selectSingleNode("/ConfigCheck/CustomerAndProduct")
                var strTrue = "客户和产品信息_________已设置。";
                var strFalse = "客户和产品信息_________<font color='red'>有空缺</font>。";
                SetCheckMsg(node, "True", strTrue, strFalse);

                node = xmlDom.documentElement.selectSingleNode("/ConfigCheck/WebServerInfo")
                strTrue = "WEB服务器信息_________已设置。";
                strFalse = "WEB服务器信息_________<font color='red'>有空缺</font>。";
                SetCheckMsg(node, "True", strTrue, strFalse);

                node = xmlDom.documentElement.selectSingleNode("/ConfigCheck/DBServerInfo")
                strTrue = "DB服务器信息_________已设置。";
                strFalse = "DB服务器信息_________<font color='red'>有空缺</font>。";
                SetCheckMsg(node, "True", strTrue, strFalse);

                node = xmlDom.documentElement.selectSingleNode("/ConfigCheck/CollectSchedule")
                strTrue = "采集调度计划_________已启用。";
                strFalse = "采集调度计划_________<font color='red'>未启用</font>。";
                SetCheckMsg(node, "True", strTrue, strFalse);


                //modified by chenyong 2010-06-21 方案调整，新增是否设置ERP站点检查
                var erpSite = xmlDom.documentElement.selectSingleNode("/ConfigCheck/ErpSite")
                if (erpSite)
                {
                    if (erpSite.text == "")
                    {
                        messageDiv.innerHTML += "日志采集的ERP站点_________<font color='red'>未选择日志管理系统要采集的ERP站点，请在：配置管理 --> WEB服务器信息 中设置</font>。";
                        messageDiv.innerHTML += "<br/>";
                    }
                    else
                    {
                        messageDiv.innerHTML += "日志采集的ERP站点_________已设置为：" + erpSite.text + "。";
                        messageDiv.innerHTML += "<br/>";
                        
                        var iISLogState = xmlDom.documentElement.selectSingleNode("/ConfigCheck/IISLogState")
                        strFalse = "IIS日志_________<font color='red'>未启用，服务IIS日志未开启</font>。";
                        SetCheckMsg(iISLogState, "True", null, strFalse);

                        var iISLogFormat = xmlDom.documentElement.selectSingleNode("/ConfigCheck/IISLogFormat")
                        strFalse = "IIS日志_________<font color='red'>活动日志格式应该为“W3C 扩展日志文件格式”</font>。";
                        SetCheckMsg(iISLogFormat, "True", null, strFalse);

                        var logFilePeriod = xmlDom.documentElement.selectSingleNode("/ConfigCheck/LogFilePeriod")
                        strFalse = "IIS日志_________<font color='red'>“新日志计划”设置不正确，应该为“每天”</font>。";
                        SetCheckMsg(logFilePeriod, "True", null, strFalse);

                        var logfield = xmlDom.documentElement.selectSingleNode("/ConfigCheck/Logfield")
                        if (logfield)
                        {
                            if (logfield.text != null && logfield.text != "")
                            {
                                messageDiv.innerHTML += "IIS日志_________<font color='red'>“扩展日志选项”设置不正确，“" + logfield.text + "”字段没有勾选</font>。";
                                messageDiv.innerHTML += "<br/>";
                            }
                        }

                        var readIISLog = xmlDom.documentElement.selectSingleNode("/ConfigCheck/ReadIISLog")
                        strFalse = "IIS日志_________<font color='red'>无权限读取IIS日志文件</font>。";
                        if (readIISLog.getAttribute("logfolder") != null)
                        {
                            strFalse = "IIS日志_________<font color='red'>无权限读取IIS日志文件，请设置“Network Service”用户对：“" + readIISLog.getAttribute("logfolder") + "”文件夹";
                            strFalse += "有读取的权限</font>。";
                        }
                        SetCheckMsg(readIISLog, "True", null, strFalse);

                        if ((iISLogState && iISLogState.text == "True") && (iISLogFormat && iISLogFormat.text == "True")
                            && (logFilePeriod && logFilePeriod.text == "True") && (logfield && logfield.text == "")
                            && (readIISLog && readIISLog.text == "True"))
                        {
                            messageDiv.innerHTML += "IIS日志_________验证通过。";
                            messageDiv.innerHTML += "<br/>";
                        }                        
                    }
                }

                node = xmlDom.documentElement.selectSingleNode("/ConfigCheck/ReadWindowsLog")
                strTrue = "Windows日志_________验证通过。";
                strFalse = "Windows日志_________<font color='red'>无法访问Windows日志信息</font>。";
                SetCheckMsg(node, "True", strTrue, strFalse);
            }
            catch (e)
            {
                alert("配置检查发生异常，请稍后再试。");
            }

            closeWaiting();
        }

        function SetCheckMsg(node, strCondition, strTrueMsg, strFalseMsg)
        {
            if (node == null) return;
            var messageDiv = document.getElementById("Message");

            if (node.text == strCondition)
            {
                if (strTrueMsg != null && strTrueMsg != "")
                {
                    messageDiv.innerHTML += strTrueMsg;
                    messageDiv.innerHTML += "<br/>";
                }
            }
            else
            {
                if (strFalseMsg != null && strFalseMsg != "")
                {
                    messageDiv.innerHTML += strFalseMsg;
                    messageDiv.innerHTML += "<br/>";
                }
            }
        }

    </script>
    <style type="text/css">
    .title    
    {
    	font-size:14pt; 	
    }
    .chekDetail
    {
    }
    </style>

</head>
<body ms_positioning="GridLayout" style="padding: 10px;" onload="window_onload()">
    <form id="form1" runat="server">
    <table style="font-size: 9pt;" height="100%" cellspacing="0" cellpadding="0" width="100%">
        <tr height="1">
            <td>
                <mnu:AppFormMenu ID="appFormMenu" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                <br />管理系统配置检查明细
                <br />
                <br />
                <div id='Message' style='width: 100%; height: 90%; border: 1px black solid; padding:5 5 0 10; line-height:16px;'>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <cnt:AppForm ID="appForm" runat="server" ProcessType="xmlhttp">
                </cnt:AppForm>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
